﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<List<CourseSystem.Common.Chat.ChatModel>>" %>
<div id="allContent">
    <% foreach (var item in Model)
       {%>
    <div id="content">
        <p>
            <%=item.SendTime.ToString("yyyy-MM-dd HH:mm") %></p>
        <p>
            <%=item.Name %>说:<%=item.Message %></p>
    </div>
    <%}  %>
</div>
<% Html.RenderPartial("HeaderUc"); %>
<link href="<%=ResolveUrl("~/Content/Logoned.css") %>" rel="stylesheet" type="text/css" />
<script type="text/javascript">
    $(function () {
        window.scroll(0, document.body.scrollHeight);
        window.setInterval("reload()", 5000);
    });
  
    var reload = function () {
        //  window.location.reload();
        $.get(appRoot + "Ajax/GetChatMessage?rd=" + rdTime(), function (data) {
            var needScore = document.body.scrollTop + document.body.clientHeight == document.body.scrollHeight;
            $("#allContent").html(data);
            if (needScore)
                window.scroll(0, document.body.scrollHeight);
        });
    };

</script>
